!
! Modulephot - global options (variables + constants) for muniphot 
!
!

module modulephot

!
! Parameters
!
! NOPT is the number of optional parameters which may be altered by the
!      user.
!
! NCMD is the number of commands are recognized by the program.
!
! MAXPIC is the maximum number of pixels in an image 2560000 = 1600**2.
!
!                      WARNING
!
! IF ANY OF THE FOLLOWING THREE PARAMETERS IS CHANGED, IT MUST
! ALSO BE CHANGED IN THE FILE CONTAINING THE ROUTINE GETPSF.
! MAXPAR MUST BE CHANGED IN TWO PLACES IN THAT FILE.
!
! MAXPSF is the maximum size of the PSF arrays.
!
! MAXEXP is the maximum number of PSF lookup tables allowed.
!        MAXEXP must be at least 2, because I use PSF as scratch
!        space in FIND.
!
! MAXPAR is the maximum number of parameters allowed in the analytic
!        part of the model PSF.
!
!                End of WARNING
!
! MAXBOX is the length of the side of the largest box that will
!        be used for convolving the image in FIND.  MAXBOX must
!        be less than MAXPSF, because I use the array PSF as
!        scratch space in FIND.
!
! MAXSKY is the maximum number of pixels that will be used in any
!        sky determination.  This will affect the speed of the
!        sky determinations in the SKY and FIND routines (more
!        pixels means slower, of course).  It will also affect
!        the maximum outer sky radius in the PHOTOMETRY routine.
!


integer, parameter :: NOPT = 19

character(len=26) :: LBL(NOPT) =             &
            (/ ' READ NOISE (ADU; 1 frame)', &  !  1
               '    GAIN (e-/ADU; 1 frame)', &  !  2
               'LOW GOOD DATUM (in sigmas)', &  !  3
               '  HIGH GOOD DATUM (in ADU)', &  !  4
               '            FWHM OF OBJECT', &  !  5
               '     THRESHOLD (in sigmas)', &  !  6
               ' LS (LOW SHARPNESS CUTOFF)', &  !  7
               'HS (HIGH SHARPNESS CUTOFF)', &  !  8
               ' LR (LOW ROUNDNESS CUTOFF)', &  !  9
               'HR (HIGH ROUNDNESS CUTOFF)', &  ! 10
               '            WATCH PROGRESS', &  ! 11
               '            FITTING RADIUS', &  ! 12
               '                PSF RADIUS', &  ! 13
               '              VARIABLE PSF', &  ! 14
               'FRACTIONAL-PIXEL EXPANSION', &  ! 15
               '        ANALYTIC MODEL PSF', &  ! 16
               ' EXTRA PSF CLEANING PASSES', &  ! 17
               '      PERCENT ERROR (in %)', &  ! 18
               '      PROFILE ERROR (in %)' /)  ! 19

real :: opt(NOPT) =        &
                  (/  0.,  &    ! 1
                      1.,  &     
                      7.,  &       
                 32766.5,  &
                     3.0,  &    ! 5
                      4.,  &
                     0.2,  &
                      1.,  &
                     -1.,  &
                      1.,  &    ! 10
                      1.,  &
                      2.,  &
                     11.,  &
                      0.,  &
                      0.,  &    ! 15
                      1.,  &
                      0.,  &
                    0.75,  &
                       5. /)

real :: omin(NOPT) =       & 
               (/ 1.E-30,  &    ! 1
                  1.E-30,  & 
                      0.,  & 
                      0.,  & 
                   0.001,  &    ! 5
                      0.,  & 
                      0.,  & 
                     0.6,  & 
                     -2.,  & 
                      0.,  &    ! 10
                     -2.,  & 
                      1.,  & 
                      .5,  & 
                    -1.5,  & 
                    -0.5,  &    ! 15
                     0.5,  & 
                      0.,  & 
                      0.,  & 
                       0. /)

real :: omax(NOPT) =        &
                (/ 1.E30,   &      ! 1  
                   1.E30,   &  
                   1.E30,   &  
               999999.99,   &  
               999999.99,   &      ! 5
                   1.E30,   &  
                     0.6,   &  
                      2.,   &  
                      0.,   &  
                      2.,   &      ! 10
                      2.,   &  
                     10.,   &  
                     35.,   &  
                     2.5,   &  
                     1.5,   &      ! 15
                     6.5,   &  
                     9.5,   &  
                    100.,   &      ! 18 
                    100. /)


end module
